import Vue from "vue";
import VueRouter from "vue-router";
const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
//页面引入
import register from '../components/dh_register_brand.vue'
import details from '../components/dh_register_details.vue'

//路由挂载，vue的核心专用组件，实用的install方法调用，必须用Vue.use挂载
Vue.use(VueRouter);

//注册路由
const routes = [
    {
        path: '/',
        redirect: '/register',
    },{
        path: '/register',
        name: 'register',
        component: register
    },{
        path: '/details/:aid',
        name: 'details',
        component: details
    }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

//注册路由暴露
export default router